Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Error Handling #62

Merged
merged 1 commit into from
Oct 4, 2024
Merged

Conversation

Ankush0286
Copy link
Contributor

@Ankush0286 Ankush0286 commented Oct 3, 2024

Added try-except for error handling:

In both handleAllFlag and find_duplicates, I added a try-except block around the future.result() call. If an exception occurs, it catches the error, logs a message with the file path, and continues processing other files.

Description

  • Fixes Error Handling #56
    The updated error handling in the code ensures that any errors encountered while processing files are caught and handled gracefully, without crashing the program. Specifically, it does the following:
  1. Try-Except Block for Each File:
    For each file being processed in both the handleAllFlag and find_duplicates functions, the program attempts to process the file inside a try block.
    If any exception occurs (e.g., permission issues, file is in use), the except block catches it.

  2. Error Reporting:
    When an error occurs, the program prints an informative message to the user. This message includes the file path that caused the error and a description of the error.
    This helps users understand which file caused the issue and what went wrong (e.g., permission denied, file not found).

  3. Prevents Crashes:
    By handling exceptions, the program can continue processing other files even if some files cause errors, improving robustness.

  • Bug fix (non-breaking change which fixes an issue)

Type of change

I have added error handling to fix a specific issue in the existing code where the program crashes due to unhandled exceptions (e.g., permission issues or files in use). This change improves the stability and robustness of the application without introducing new features or breaking changes.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes
  • I have maintained a clean commit history by using the necessary Git commands
  • I have checked that my code does not cause any merge conflicts

Added try-except for error handling:

In both handleAllFlag and find_duplicates, I added a try-except block around the future.result() call.
If an exception occurs, it catches the error, logs a message with the file path, and continues processing other files.
@Kota-Karthik
Copy link
Owner

@Ankush0286
LGTM!

@Kota-Karthik Kota-Karthik merged commit a3ec579 into Kota-Karthik:main Oct 4, 2024
2 checks passed
@Ankush0286
Copy link
Contributor Author

Ankush0286 commented Oct 5, 2024

@Kota-Karthik Can you add the gssoc-ext label and level label in pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error Handling
3 participants